import com.google.gson.Gson;

public class json {
    public static void main(String[] args){
//        {"age":22,"clazz":"文科六班","gender":"女","id":"1500100001","name":"施笑槐"}
        String jsonstr="{\"age\":22,\"clazz\":\"文科六班\",\"gender\":\"女\",\"id\":\"1500100001\",\"name\":\"施笑槐\"}";
        System.out.println(jsonstr);
        //通过Gson解析json字符串,转化为对象
//        Gson gson = new Gson();
//        student student = gson.fromJson(jsonstr, student.class);
//        System.out.println(student.getSex());
        //对象转化为json字符串
        student s = new student("1001","zs","25","一班","男");
        Gson gson = new Gson();
        String s1 = gson.toJson(s);
        System.out.println(s1);
    }
}
